<?php 
	class Manage_member extends CI_Controller{
		public function __construct(){
			parent::__construct();
			$this->load->library('session');
			$this->load->library('form_validation');
			$this->load->library('cismarty');
			$this->load->model("apanel/template");
			$this->load->model("apanel/db_member");
			$this->load->library('pagination');
		}
		
		public function index(){
			redirect('mange_member/member_list');
		}
		
		public function member_list($st=""){
			if($this->session->userdata('sess_login') == null)
				redirect('apanel');
			//list($item,$num,$page,$total) = $this->listall();
			//$this->cismarty->assign("total",$total);
			if($st == "success"){
				$this->cismarty->assign("status","<div class=\"mws-form-message success message\">Success</div>");
			}
			$scripts = '
			<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
			$(\'#table1\').dataTable( {
			"bJQueryUI": true,
			"bProcessing": true,
			"bServerSide": true,
			"sAjaxSource": "'.base_url().'manage_member/datalist",
			"iDisplayStart"  : 0,
			"sPaginationType": "full_numbers",
			"aaSorting": [[ 0, "desc" ]],
			"aoColumnDefs": [
			{ "bSortable": false, "aTargets": [ 0 ] },
			],
			"fnServerData": function(sSource, aoData, fnCallback)
			{
			$.ajax(
			{
			\'dataType\': \'json\',
			\'type\'  : \'POST\',
			\'url\'    : sSource,
			\'data\'  : aoData,
			\'success\' : fnCallback
			}
			);
			}
			} );
			} );
			</script>';
			$this->cismarty->assign("scripts",$scripts);
			//== template
			$this->cismarty->assign("header",$this->template->header());
			$this->cismarty->assign("menu",$this->template->menu(1,2));
			$this->cismarty->assign("footer",$this->template->footer());
			$this->cismarty->assign("url",base_url());
			$this->cismarty->assign("form_open",form_open('manage_member/member_delAll'));
			$this->cismarty->assign("form_close",form_close());
			$this->cismarty->display('apanel/member/member_list.html');
		}
		
		public function datalist(){
			$output = $this->db_member->datalist();
			echo json_encode($output);
		}
		
		public function member_del($id){
			$this->db->where("pkid",$id);
			$this->db->delete("mobile_member");
			redirect('apanel/dashboard');
		}
		
	}
?>